package com.aos.dto;

public class Result {
    private Integer status;
    private String message;
    private Object data;

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public static Result error() {
        return error(500, "未知异常，请联系管理员");
    }

    public static Result error(String msg) {
        return error(500, msg);
    }

    public static Result error(int code, String msg) {
        Result r = new Result();
        r.setStatus(code);
        r.setMessage(msg);
        return r;
    }

    public static Result ok(int code,String msg,Object data) {
        Result r = new Result();
        r.setStatus(code);
        r.setMessage(msg);
        r.setData(data);
        return r;
    }

    public static Result ok(String msg) {
        return ok(200,msg,null);
    }

    public static Result ok() {
        return ok(200,"",null);
    }

    public static Result ok(Object data){
        return ok(200,"",data);
    }
}
